package com.taokatao.cardmee.db;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.taokatao.cardmee.db.model.Card;
import com.taokatao.cardmee.db.model.CardGrade;
import com.taokatao.cardmee.db.model.CardStore;
import com.taokatao.cardmee.db.model.Message;
import com.taokatao.cardmee.db.model.User;

import com.taokatao.cardmee.db.CardDao;
import com.taokatao.cardmee.db.CardGradeDao;
import com.taokatao.cardmee.db.CardStoreDao;
import com.taokatao.cardmee.db.MessageDao;
import com.taokatao.cardmee.db.UserDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig cardDaoConfig;
    private final DaoConfig cardGradeDaoConfig;
    private final DaoConfig cardStoreDaoConfig;
    private final DaoConfig messageDaoConfig;
    private final DaoConfig userDaoConfig;

    private final CardDao cardDao;
    private final CardGradeDao cardGradeDao;
    private final CardStoreDao cardStoreDao;
    private final MessageDao messageDao;
    private final UserDao userDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        cardDaoConfig = daoConfigMap.get(CardDao.class).clone();
        cardDaoConfig.initIdentityScope(type);

        cardGradeDaoConfig = daoConfigMap.get(CardGradeDao.class).clone();
        cardGradeDaoConfig.initIdentityScope(type);

        cardStoreDaoConfig = daoConfigMap.get(CardStoreDao.class).clone();
        cardStoreDaoConfig.initIdentityScope(type);

        messageDaoConfig = daoConfigMap.get(MessageDao.class).clone();
        messageDaoConfig.initIdentityScope(type);

        userDaoConfig = daoConfigMap.get(UserDao.class).clone();
        userDaoConfig.initIdentityScope(type);

        cardDao = new CardDao(cardDaoConfig, this);
        cardGradeDao = new CardGradeDao(cardGradeDaoConfig, this);
        cardStoreDao = new CardStoreDao(cardStoreDaoConfig, this);
        messageDao = new MessageDao(messageDaoConfig, this);
        userDao = new UserDao(userDaoConfig, this);

        registerDao(Card.class, cardDao);
        registerDao(CardGrade.class, cardGradeDao);
        registerDao(CardStore.class, cardStoreDao);
        registerDao(Message.class, messageDao);
        registerDao(User.class, userDao);
    }
    
    public void clear() {
        cardDaoConfig.clearIdentityScope();
        cardGradeDaoConfig.clearIdentityScope();
        cardStoreDaoConfig.clearIdentityScope();
        messageDaoConfig.clearIdentityScope();
        userDaoConfig.clearIdentityScope();
    }

    public CardDao getCardDao() {
        return cardDao;
    }

    public CardGradeDao getCardGradeDao() {
        return cardGradeDao;
    }

    public CardStoreDao getCardStoreDao() {
        return cardStoreDao;
    }

    public MessageDao getMessageDao() {
        return messageDao;
    }

    public UserDao getUserDao() {
        return userDao;
    }

}
